<template>
	<view class="product" @click="productDetail">
		<view class="product-top">
			<view style="width: calc(100% - 80px);white-space: nowrap;text-overflow: ellipsis;overflow: hidden;">
				{{ obj.title }}
			</view>
			<view style="font-size: 12px;color: gray;width: 76px;text-align: right;">
				资费详情 >
			</view>
		</view>
		<view class="product-center">
			<view class="product-img">
				<image :src="obj.img" mode="scaleToFill" style="width: 100%;height: 100%;">
				</image>

			</view>
			<view class="product-content">
				<view style="text-align: left;width: 100%;color: #999;font-size: 12px;">
					{{ obj.desc }}
				</view>
				<view class="content-1">
					<view class="content-2">
						<view class="title">
							{{ obj.size }} <span class="unit">G</span>
						</view>
						<view class="note">
							通用流量
						</view>
					</view>
					<view class="line"></view>
					<view class="content-2">
						<view class="title">
							{{ obj.none }}<span class="unit">G</span>
						</view>
						<view class="note">
							定向流量
						</view>
					</view>
					<view class="line"></view>
					<view class="content-2">
						<view class="title">
							{{ obj.time }}<span class="unit">分钟</span>
						</view>
						<view class="note">
							通话时长
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="product-bottom">
			<view style="font-size: 12px;color: #999;">
				{{ obj.note }}
			</view>
			<view class="css-get">免费领取</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "product-item",
		props: ["obj"],
		data() {
			return {

			};
		},
		methods: {
			productDetail() {
				// this.$uniGo("navigateTo", {
				// 	url: "/pages/detail/detail",
				// 	success: () => {
				// 		console.log("成功")
				// 	}
				// })
				uni.$emit("NOTIFICATION_ProductDetail", this.obj);
			}
		}
	}
</script>

<style lang="scss" scoped>
	.product {

		margin-bottom: 15rpx;
		background: #fff;
		border-radius: 10px;
		padding: 20px 10px;

		.product-top {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 20px;
		}

		.product-img {
			width: 100px;
			height: 100px;
			border-radius: 5px;
			overflow: hidden;

			image {
				width: 100%;
				height: auto;
			}
		}

		.product-content {
			width: calc(100% - 100px);
			padding: 0 10px;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			.content-1 {
				width: 100%;
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 5px 0 0 0;
			}

			.title {
				font-size: 20px;
				font-weight: bolder;
				margin-bottom: 3px;
			}

			.note {
				font-size: 12px;
				color: #999;
			}

			.unit {
				font-size: 14px;
			}

			.line {
				width: 1px;
				height: 30px;
				background-color: #e3e3e3;
			}

			.content-2 {}

		}

		.product-center {
			display: flex;
			justify-content: space-between;
		}

		.product-bottom {
			display: flex;
			justify-content: space-between;
			align-items: center;
			color: gray;
			margin-top: 10px;
		}

		.css-get {
			width: 80px;
			text-align: center;
			height: 30px;
			border-radius: 17px;
			background-color: #08a0e2;
			color: white;
			line-height: 30px;
			font-size: 12px;
		}
	}
</style>